package cn.njxzc.book.masterexamples.ch14;

import java.util.Arrays;

public class ArrayDemo1 {
	public static void main(String args[]) {
		int[] a1 = new int[10];
		int[] a2 = new int[10];
		String[][] a3 = new String[][] { { "a1", "a2" }, { "b1", "b2" } };
		Arrays.fill(a1, 37);
		Arrays.fill(a2, 47);

		System.out.println("方法1：");
		for (int i = 0; i < a1.length; i++) {
			System.out.println(a1[i]);
		}
		System.out.println("方法2：");
		for (int i : a2) {
			System.out.println(i);
		}
		for (String[] strings : a3) {
			for (String str : strings) {
						System.out.println(str);
			}
		}
		System.out.println(Arrays.equals(a1, a2));
		a2[3] = 11;
		a2[2] = 9;
		System.out.println(Arrays.equals(a1, a2));
		Arrays.sort(a2);
		System.out.println(Arrays.binarySearch(a2, 11));
	}
}
